package net.sxnic.workflow.node.utils;

import net.sxnic.workflow.utils.WorkflowUtils;

import org.apache.commons.lang3.StringUtils;

public class ButtonUtils {
	
	/**
	 * 根据配置文件创建button的html代码
	 * @param config 如果为空，则只有“返回”按钮代码
	 * @return
	 */
	public static String createButtonsHtml(String config,String contextPath){
		StringBuilder sb = new StringBuilder();
		
		if(StringUtils.isBlank(config)){
			return "";
		}
		
		String[] config_s = StringUtils.split(config, ",");
		
		for(String c:config_s){
			sb.append(WorkflowUtils.getWfConfig("button_html_"+c).replace("${contextPath}",contextPath)+"&nbsp;&nbsp;");			
		}		
		
		return sb.toString();
	}
}
